import requestApi from '@/utils/requestApi'
import { appId } from '@/utils/appSetup'
import { parseStrEmpty } from "@/utils/ruoyi";
// let conversationsbase = "http://1.13.176.116:888"
let conversationsbase = "/conversationsbase"





export function markmapreq (data) {
  return requestApi({
    url: "http://1.13.176.116:888/v1/chat-messages",
    method: "post",
    data,
    headers: {
      "Content-Type": "application/json",
      Authorization: "Bearer app-TTybm74kvzn9c454q3QXtC03",
    }
  })
}


export function search_image (params) {
  return requestApi({
    url: "v4/search_image",
    method: "GET",
    params,
  })
}

export function conversations (params) {
  // http://1.13.176.116:888/v1/conversations
  return requestApi({
    url: conversationsbase + "/v1/conversations",
    method: "GET",
    headers: {
      "Content-Type": "application/json",
      Authorization: "Bearer " + appId,
    },
    params,
  })
}

export function delconversations (data, id) {
  // http://1.13.176.116:888/v1/conversations
  return requestApi({
    url: conversationsbase + "/v1/conversations/" + id,
    method: "DELETE",
    headers: {
      "Content-Type": "application/json",
      Authorization: "Bearer " + appId,
    },
    data
  })
}


export function messages (params) {
  return requestApi({
    url: conversationsbase + "/v1/messages",
    method: "GET",
    headers: {
      "Content-Type": "application/json",
      Authorization: "Bearer " + appId,
    },
    params,
  })
}
export function upload (data) {
  return requestApi({
    url: "http://1.13.176.116:888/v1/files/upload",
    method: "POST",
    headers: {
      "Content-Type": "multipart/form-data",
      Authorization: "Bearer " + appId,
    },
    data,
  })
}

export function messagesStop (data, taskId) {
  return requestApi({
    url: conversationsbase + "/v1/chat-messages/" + taskId + "/stop",
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      Authorization: "Bearer " + appId,
    },
    data,
  })
}


export function conversationsRename (data, conversation_id) {
  return requestApi({
    url: conversationsbase + "/v1/conversations/" + conversation_id + "/name",
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      Authorization: "Bearer " + appId,
    },
    data
  })
}









